<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="de.laures.cewolf.ChartPostProcessor"%>
<%@page import="java.awt.*" %>
<%@page import="java.util.*"%>
<%@page import="de.laures.cewolf.*"%>
<%@page import="de.laures.cewolf.cpp.*"%>
<%@page import="de.laures.cewolf.example.*"%>
<%@page import="de.laures.cewolf.links.*"%>
<%@page import="de.laures.cewolf.taglib.CewolfChartFactory" %>
<%@page import="de.laures.cewolf.tooltips.*"%>
<%@page import="org.jfree.chart.*"%>
<%@page import="org.jfree.chart.event.ChartProgressEvent" %>
<%@page import="org.jfree.chart.event.ChartProgressListener" %>
<%@page import="org.jfree.chart.plot.*"%>
<%@page import="org.jfree.data.*"%>
<%@page import="org.jfree.data.category.*"%>
<%@page import="org.jfree.data.gantt.*"%>
<%@page import="org.jfree.data.general.*"%>
<%@page import="org.jfree.data.time.*"%>
<%@page import="org.jfree.data.xy.*"%>
<%@taglib uri="http://cewolf.sourceforge.net/taglib/cewolf.tld" prefix="cewolf" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="js/global.js"></script>
<script type="text/javascript" src="js/tooltip.js"></script>
<link type="text/css" href="style/cewolf.css" rel="stylesheet">
</head>
<body>
<%
DatasetProducer hiloData = new DatasetProducer() {
    public Object produceDataset(Map params) {
      int itemCount = 100;
      Date[] dates = new Date[itemCount];
      double[] high = new double[itemCount];
      double[] low = new double[itemCount];
      double[] open = new double[itemCount];
      double[] close = new double[itemCount];
      double[] volume = new double[itemCount];
      Calendar cal = new GregorianCalendar();
      for (int i = 0; i < itemCount; i++) {
        cal.roll(Calendar.HOUR, 1);
        dates[i] = cal.getTime();
        high[i] = Math.random() * 100 + 100;
        low[i] = high[i] - (Math.random() * 30);
        open[i] = low[i] + (Math.random() * (high[i] - low[i]));
        close[i] = open[i] + (Math.random() * (high[i] - open[i]));
        volume[i] = Math.random() * 1000;
      }
      OHLCDataset ds = new DefaultHighLowDataset("Laures, Inc.", dates, high, low, open, close, volume);
      return ds;
    }
    public String getProducerId() {
      return "HiLoDataProducer";
    }
    public boolean hasExpired(Map params, Date since) {
      return false;
    }
  };
  pageContext.setAttribute("highLowData", hiloData);
%>
<div>
<cewolf:chart id="candleStick" title="CandleStick" type="candleStick" xaxislabel="Time">
    <cewolf:data>
        <cewolf:producer id="highLowData" />
    </cewolf:data>
</cewolf:chart>
<cewolf:img chartid="candleStick" renderer="/cewolf" width="800" height="400"/>
</div>
<div>
	<cewolf:chart id="highLow" title="HighLow" type="highLow" xaxislabel="Time">
    <cewolf:data>
        <cewolf:producer id="highLowData" />
    </cewolf:data>
	</cewolf:chart>
	<cewolf:img chartid="highLow" renderer="/cewolf" width="800" height="400"/>
</div>
</body>
</html>